﻿@using PerpetuumSoft.Knockout
@using ContractorTimesheet.DataModel
@using ContractorTimesheet.Infrastructure

@model ContractorTimesheet.Models.ResetPasswordModel

@{
    var ko = Html.CreateKnockoutContext();

    User loginUser = CurrentSession.User;
}

<h2>Reset Password</h2>

<form id="myform">
    <div>
        <table border="0" width="100%">
            <tbody>
                <tr>
                    <td colspan="4">
                        <hr />
                    </td>
                </tr>
                <tr>
                    <td height="30" width="15%">
                        Firstname
                    </td>
                    <td width="15%">
                        Lastname
                    </td>
                    <td width="15%">
                        &nbsp;
                    </td>
                    <td>
                        
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <hr />
                    </td>
                </tr>
                @using (var user = ko.Foreach(m => m.ResetInfo))
                {
                    <tr>
                        <td height="30" width="15%">
                            @user.Html.Span(m => m.Firstname)
                        </td>
                        <td>
                            @user.Html.Span(m => m.Lastname)
                        </td>
                        <td >
                            @if (loginUser.IsAdmin)
                            {
                                @user.Html.HyperlinkButton("Reset Password", "ResetPassword", "ResetPassword", new { index = @user.GetIndex() })
                            }
                        </td>
                        <td>
                            @user.Html.Span(m => m.Message)
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</form>

@ko.Apply(Model)
